#pragma once

#ifndef EDITOR_LIBRARY__INCLUDED__HH__
#define EDITOR_LIBRARY__INCLUDED__HH__

#include "LitEditorPrerequisites.h"

#include "LitEditorLogger.h"
#include "LitEditorRenderWidget.h"
#include "LitCore.h"
#include <qobject.h>
#include <qdockwidget.h>

namespace Lit
{
	namespace Editor
	{
		class LIT_API Instance : public QObject, public Initialiser
		{
			Q_OBJECT

		protected slots:
			void ogreInitialise();
			void ogreShutdown();

		protected:
			QMainWindow *	mMainWindow;
			RenderWidget *	mRenderWidget;
			Logger	*		mLogger;
			std::string		mName;
			Lit::CoreComponentList mComponents;
			std::vector<std::string> mArgs;
		public:
			Instance( const std::string &name, QMainWindow * main_win, QDockWidget * log_dock );
			~Instance();

			void addRenderListener( RenderWidgetListener * lst );
			void removeRenderListener( RenderWidgetListener * lst );
			bool hasRenderListener( RenderWidgetListener * lst ) const;
			
			const std::vector<std::string> & getCommandArguments() const;
			std::vector<std::string> &getCommandArguments(); 
			void setCommandArguments( const QStringList &args );

			Ogre::SceneManager * getSceneManager();
			const Ogre::SceneManager * getSceneManager() const;

			Ogre::Camera* getSceneCamera();
			const Ogre::Camera* getSceneCamera() const;

			const QMainWindow * getMainWindow() const;
			QMainWindow * getMainWindow();

			const RenderWidget* getRenderWidget() const;
			RenderWidget * getRenderWidget();

			const Logger* getLogger() const;
			Logger* getLogger();

			const std::string &getName() const;
			
			void initialise( CoreComponentList components, RenderWidget * widget=NULL, RenderWidgetListener * lst=NULL );
			void deInitialise(RenderWidgetListener * lst=NULL);
		};
	};
};

#endif